package com.saturdaycoder.volumeman;

import android.app.Activity;
import android.app.Notification;
import android.app.PendingIntent;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.Button;

public class ProfileSelectActivity extends Activity {
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);  
		setContentView(R.layout.profileselection);
		
		Intent[] intents = new Intent[5];
		Button[] buttons = new Button[5];
		buttons[0] = (Button)findViewById(R.id.button0);
		buttons[1] = (Button)findViewById(R.id.button1);
		buttons[2] = (Button)findViewById(R.id.button2);
		buttons[3] = (Button)findViewById(R.id.button3);
		buttons[4] = (Button)findViewById(R.id.button4);

		
		for (int i = 0;i < 5; ++i ) {
			intents[i] = new Intent(ProfileSelectActivity.this, ProfileSwitchService.class);
			intents[i].putExtra(VolumeMan.EXTRA_PROFILE_INDEX, i);
			
			buttons[i].setOnClickListener(new OnProfileClickListener(i));
		}
		
	}
	
	@Override
	public void onDestroy() {
		super.onDestroy();
		
	}
	
	private class OnProfileClickListener implements Button.OnClickListener {
		//@Override
		int profileId;
		public OnProfileClickListener(int i) {
			this.profileId = i;
		}
		public void onClick(View v) {
			Intent it = new Intent(ProfileSelectActivity.this, ProfileSwitchService.class);
			it.putExtra(VolumeMan.EXTRA_PROFILE_INDEX, profileId);
			ProfileSelectActivity.this.startService(it);
			ProfileSelectActivity.this.finish();
		}
	}
}
